package com.link.cloud;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.link.cloud.config.interceptor.LoginInterceptor;

/**
 * web 拦截器/参数解析器/消息转换的配置
 * 
 * <br>
 * <mvc:interceptors>
 * <mvc:argument-resolvers>
 * <mvc:message-converters>
 * 
 */
// 增加@EnableWebMvc注解，关闭spring boot的mvc默认配置，改为自定义配置
@EnableWebMvc
@Configuration
public class CustomWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
	
	@Override
    public void addInterceptors(InterceptorRegistry registry) {

        // registry.addInterceptor(localeChangeInterceptor());

        // 注入http请求响应的拦截
        // rest请求打印到控制台
        registry.addInterceptor(new LoginInterceptor());

    }
}
